<extend name="Public:base"/>

<block name="main">
<style>
.iframe_div{
    width: 400px;
    background: url("__IMG__/iphone.png") no-repeat;
    overflow: hidden;
    padding-left: 27px;
    padding-top: 94px;
    height: 655px;
}
#wap_show{
    background: #fff none repeat scroll 0 0;
}
</style>
<load href="__JS__/swfupload.js"/>

<div id="yzh-content" class="col-xs-12">
    <div class="main-title">
        <h2>模板编辑</h2>
    </div>

    <div class="center-block iframe_div">

        {if $langid==1}
            <iframe id="wap_show" src="http://{$SITE_WAP_DOMAIN}" width="320" height="462" frameborder="0" scrolling="yes"></iframe>
        {else}
        <iframe id="wap_show" src="http://{$SITE_WAP_DOMAIN}/en.html" width="320" height="462" frameborder="0" scrolling="yes"></iframe>
        {/if}
    </div>

</div>


<script type="text/javascript">
document.domain = "{$Think.session.rootdomain}";
var iframe = document.getElementById('wap_show');

if (iframe.attachEvent){
    iframe.attachEvent("onload", function(){
        editblock();
    });
} else {
    iframe.onload = function(){
        editblock();
    };
}

function editblock(){

    // var arrBlock = $('#wap_show').contents().find('.yzh-block');

    $('#wap_show').contents().find(".yzh-block").css({
        border: '1px solid red',
        position: 'relative',
    }).append('<button style="position:absolute;top:0;right:0;">编辑</button>')

    $('#wap_show').contents().find(".yzh-block").click(function(event) {
        var blockname = $(this).attr('block');

        $.scojs_modal({
            title: '编辑',
            remote: "{:U('Wap/editblock')}"+'&blockname='+blockname,
            width: '700px',
            height:'500px'
        }).show();
    });

}
</script>
</block>